import { Define, EntityObjectFactory } from 'tiny-entity2';
const EntityObjectType = EntityObjectFactory.GetEntityObjectType(process.env.dataBaseType || 'mysql');

@Define.Table({ TableName: "orderdelivery" })
export class OrderDelivery extends EntityObjectType<OrderDelivery> {
    @Define.PrimaryKey()
    id: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        IsIndex: true
    })
    orderId: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR
    })
    source: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR
    })
    receiverName: string;

    @Define.Column({
        DataType: Define.DataType.Array
    })
    receiverPhones: string[];

    @Define.Column({
        DataType: Define.DataType.VARCHAR
    })
    receiverAddress: string;

    /**
     * 收货地址纬度
     *
     * @type {number}
     * @memberof OrderDelivery
     */
    @Define.Column({
        DataType: Define.DataType.Decimal
    })
    receiverLat: number;

    /**
     * 收货地址经度 
     *
     * @type {number}
     * @memberof OrderDelivery
     */
    @Define.Column({
        DataType: Define.DataType.Decimal
    })
    receiverLng: number;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        IsIndex: true
    })
    fetchCode: string;

    @Define.Column({
        DataType: Define.DataType.Decimal
    })
    fee: number;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        DataLength: 500
    })
    note: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR
    })
    status: string;

    @Define.Column({
        DataType: Define.DataType.JSON
    })
    extends: any;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        IsIndex: true
    })
    storeId: string;

    @Define.Column({
        DataType: Define.DataType.BIGINT
    })
    createTime: number;
}